<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('维保维修工程水/电派工单项目列表')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">维修材料费用</li>
    </ol>
    <div class="aLine"></div>
</div>
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
<!--                th:object="${mtId}"-->
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px">维修项目名称：</label>
                                <input type="text" name="mMpname"/>
                            </li>
                            <li>
                                <label style="width: 100px">维修项目状态：</label>
                                <select name="mStatus" th:with="type=${@dict.getType('maintenance_project_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}">
                                    </option>
                                </select>
<!--                                <select name="mStatus">-->
<!--                                    <option value="">所有</option>-->
<!--                                </select>-->
                            </li>
                            <li>
                                <label style="width: 120px">维修费支付状态：</label>
                                <select name="mCoststatus" th:with="type=${@dict.getType('maintenance_coststatus')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
<!--                                <select name="mCoststatus">-->
<!--                                    <option value="">所有</option>-->
<!--                                </select>-->
                            </li>
                            <li class="select-time">
                                <label>创建时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginMDate]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endMDate]"/>
                            </li>
                            <li hidden>
                                <label>外键id：</label>
                                <input type="text" name="mtId"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:forengineers:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('ruoyi:engineers:edit')}]];
        var removeFlag = [[${@permission.hasPermi('ruoyi:engineers:remove')}]];
        var prefix = ctx + "ruoyi/forengineers";
        // var mtId=[[*{mtId}]];
        //维修项目状态
        var mStatus = [[${@dict.getType('maintenance_project_status')}]];
        //维修费支付状态
        var mCoststatus = [[${@dict.getType('maintenance_coststatus')}]];
        $(function() {
            var options = {
                url: prefix + "/list",
                exportUrl: prefix + "/export",
                modalName: "维保维修工程水/电派工单项目",
                showColumns: false,
                columns: [
                {
                    field: 'mPid', 
                    title: '维修项目id',
                    visible: false
                },
                {
                    field: 'mMpname', 
                    title: '维修项目名称'
                },
                    {
                        field: 'mStatus',
                        title: '维修项目状态',
                        align: 'center',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(mStatus, value);
                        }
                    },
                {
                    field: 'mPriceSheet', 
                    title: '维修联系单/报价单',
                    align: 'center',
                    formatter: function(value, row, index) {
                        // return $.table.imageView(value);
                        var actions = [];
                        if(row.mPriceSheet==null){
                            actions.push('未上传');
                            return actions.join('');
                        }else{
                            return '<a href="javascript:downloadFile(\''+row.mPriceSheet+'\')">下载</a>';
                        }
                    }
                },
                    {
                        field: 'mJobOrder',
                        title: '水/电派工单',
                        align: 'center',
                        formatter: function(value, row, index) {
                            // return $.table.imageView(value);
                            var actions = [];
                            if(row.mJobOrder==null){
                                actions.push('未上传');
                                return actions.join('');
                            }else{
                                return '<a href="javascript:downloadFile(\''+row.mJobOrder+'\')">下载</a>';
                            }
                        }
                    },
                {
                    field: 'mReceipt', 
                    title: '维修发票/收据',
                    align: 'center',
                    formatter: function(value, row, index) {
                        // return $.table.imageView(value);
                        var actions = [];
                        if(row.mReceipt==null){
                            actions.push('未上传');
                            return actions.join('');
                        }else{
                            return '<a href="javascript:downloadFile(\''+row.mReceipt+'\')">下载</a>';
                        }
                    }
                },
                {
                    field: 'mCoststatus', 
                    title: '维修费支付状态',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(mCoststatus, value);
                    }
                },

                {
                    field: 'mDate', 
                    title: '创建时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="clickss(\'' + row.mPid + '\')"><i class="fa fa-add"></i>维修项目器件</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function downloadFile(mPriceSheet) {
            window.location.href=ctx+"common/download/resource?resource="+mPriceSheet;
        }
        /*function downloadFile1(mReceipt) {
            window.location.href=ctx+"common/download/resource?resource="+mReceipt;
        }
        function downloadFile2(mJobOrder) {
            window.location.href=ctx+"common/download/resource?resource="+mJobOrder;
        }*/
        function clickss(mPid) {
            var url = ctx + "ruoyi/formoneys/moneys/"+mPid;
            $.modal.openTab("维修项目器件",url);
        }
    </script>
</body>
</html>